<?php
include_once ("dictpackagesappmodel.php");
include_once ("dictappmodel.php");
include_once ("dictparamsappmodel.php");
function viewPackage()
{
	$DB = new DBConfig();
	$DB -> config();
	$DB -> conn();
	$objArr=array();
	$objPackage=new PackageQuery(-1);
	$objArr=$objPackage->selectQuery();
	$rowCount=sizeof($objArr);
	//echo "here";
	foreach($objArr as $obj)
	{
		$objX=new PackagesModel();
		$objX=$obj;
		$style="";
		if($objX->getId()==$_SESSION["packageid"])
			$style="style=\" color:red;background-color:#999\"";
		?>
        <p class="menucontent"><a <?php echo $style?> href="?packageid=<?php echo $objX->getId().$_SESSION["arg"]?>" title="<?php echo $objX->getPackagedescription()?>"><?php echo $objX->getPackagename()?></a></p>
        <?php							
	}
	
	$DB -> close();
}
function viewKWList()
{
	$DB = new DBConfig();
	$DB -> config();
	$DB -> conn();
	$objArr=array();
	$objDicts=new DictsQuery();
	$objArr=$objDicts->selectQuery($_SESSION["kw"],false,$_SESSION["packageid"],-1);
	$rowCount=sizeof($objArr);
	//echo "here";
	foreach($objArr as $obj)
	{
		$objX=new DictsModel();
		$objX=$obj;
		if($objX->getId()==$_SESSION["dictid"])
			$style="style=\" color:red;background-color:#999\"";
		?>
        <p class="itemcontent "<?php echo $style?> ><a class="itemcontent" href="?dictid=<?php echo $objX->getId().$_SESSION["arg"]."&packageid=".$_SESSION["packageid"]?>" title="<?php echo $objX->getKW()?>"><?php echo $objX->getSynonyms()?></a></p>
        <?php							
	}
	
	$DB -> close();
}
function viewResult()
{
	if($_SESSION["dictid"]!="")
	{
		$DB = new DBConfig();
		$DB -> config();
		$DB -> conn();
		$objArr=array();
		$objDicts=new DictsQuery();
		
		$objPackage=new PackageQuery();
		$objArr=$objPackage->selectQuery($_SESSION["packageid"]);
		$packagename=$objArr[0]->getPackagename();
		
		$objArr=$objDicts->selectQuery("",false,		$_SESSION["packageid"],$_SESSION["dictid"]);
		//echo $rowCount=sizeof($objArr);
			$objX=new DictsModel();
			$objX=$objArr[0];
			//print_r($objX);
			//die("here");
			?>
			
			<p><?php echo $packagename ?></p>
		<p><b><?php echo $objX->getKW() ?></b></p><p><u><?php echo $objX->getDictType() ?></u> / <u><?php echo $objX->getLanguage() ?></u></p><p><?php echo $objX->getSynonyms() ?></p><p>karaoke: <?php echo $objX->getKaraoke() ?></p><p>laoka: <?php echo $objX->getLaoka() ?></p>
		<hr/>
		<p class="itemmeaning">
		<?php echo $objX->getMeaningAndUsage() ?>
		</p>
		
			<?php							
	
		
		$DB -> close();
	}
}
?>